import ray

ray.init(address='ray://192.168.10.98:10001')


# Define the Counter actor.
@ray.remote
class Counter:

    def __init__(self):
        self.i = 0

    def get(self):
        return self.i

    def incr(self, value):
        self.i += value
        return self.i


# Create a Counter actor.
c = Counter.remote()
# ClientActorHandle
print(c)

# Submit calls to the actor. These calls run asynchronously but in
# submission order on the remote actor process.
for _ in range(10):
    obj_ref = c.incr.remote(1)
    print(ray.get(obj_ref))

# Retrieve final actor state.
print(ray.get(c.get.remote()))
# -> 10
